﻿using System.Text;

namespace Builder
{
    public class TextBuilder : Builder
    {
        private StringBuilder buffer;

        public TextBuilder()
        {
            buffer = new StringBuilder();
        }

        public string GetResult()
        {
            return buffer.ToString();
        }

        public override void MakeTitle(string title)
        {
            buffer.AppendLine("====================================");
            buffer.AppendLine("[" + title + "]");
            buffer.AppendLine();
        }

        public override void MakeString(string str)
        {
            buffer.AppendLine("■" + str);
            buffer.AppendLine();
        }

        public override void MakeItems(string[] items)
        {
            foreach (string item in items)
            {
                buffer.AppendLine("　・" + item);
            }

            buffer.AppendLine();
        }

        public override void Close()
        {
            buffer.AppendLine("====================================");
            buffer.AppendLine();
        }
    }
}
